home *** CD-ROM | disk | FTP | other *** search
- #include "graphics dispatch.h"
- #include "window layer.h"
- #include "program globals.h"
- #include "edit functions.h"
- #include "about.h"
- #include "about MSG.h"
- #include "other MSG window.h"
- #include "help.h"
- #include "brlr main window.h"
- #include "brlr floating window.h"
-
- extern Boolean gPostingEvents;
-
- enum DispatchError SetupWindowDispatch(short index, WindowPtr theWindow)
- {
- SetWindowIndex(theWindow, index);
- SetWindowTE(theWindow, 0L);
- SetWindowVScrollBar(theWindow, 0L);
- SetWindowHScrollBar(theWindow, 0L);
-
- switch (index)
- {
- case kAboutWindow:
- SetupTheAboutWindow(theWindow);
- return kSuccess;
- case kAboutMSGWindow:
- SetupTheAboutMSGWindow(theWindow);
- return kSuccess;
- case kOtherMSGWindow:
- SetupTheOtherMSGWindow(theWindow);
- return kSuccess;
- case kHelpWindow:
- SetupTheHelpWindow(theWindow);
- return kSuccess;
- case kMainWindow:
- SetupTheMainWindow(theWindow);
- return kSuccess;
- case kFloatingWindow:
- SetupTheFloatingWindow(theWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError ShutdownWindowDispatch(short index)
- {
- switch (index)
- {
- case kAboutWindow:
- ShutDownTheAboutWindow();
- return kSuccess;
- case kAboutMSGWindow:
- ShutDownTheAboutMSGWindow();
- return kSuccess;
- case kHelpWindow:
- ShutDownTheHelpWindow();
- return kSuccess;
- case kMainWindow:
- ShutDownTheMainWindow();
- return kSuccess;
- case kFloatingWindow:
- ShutDownTheFloatingWindow();
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError OpenWindowDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kAboutWindow:
- OpenTheAboutWindow(theWindow);
- return kSuccess;
- case kAboutMSGWindow:
- OpenTheMSGWindow(theWindow);
- return kSuccess;
- case kOtherMSGWindow:
- OpenTheOtherMSGWindow(theWindow);
- return kSuccess;
- case kHelpWindow:
- OpenTheHelpWindow(theWindow);
- return kSuccess;
- case kMainWindow:
- OpenTheMainWindow(theWindow);
- return kSuccess;
- case kFloatingWindow:
- OpenTheFloatingWindow(theWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError CloseWindowDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kMainWindow:
- if (CloseTheMainWindow(theWindow))
- return kSuccess;
- else
- return kCancel;
- case kFloatingWindow:
- CloseTheFloatingWindow(theWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError DisposeWindowDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kAboutWindow:
- DisposeTheAboutWindow(theWindow);
- return kSuccess;
- case kOtherMSGWindow:
- DisposeTheOtherMSGWindow(theWindow);
- return kSuccess;
- case kHelpWindow:
- DisposeTheHelpWindow(theWindow);
- return kSuccess;
- case kMainWindow:
- DisposeTheMainWindow(theWindow);
- return kSuccess;
- case kFloatingWindow:
- DisposeTheFloatingWindow(theWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError DrawWindowDispatch(short index, short theDepth)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kAboutMSGWindow:
- DrawTheAboutMSGWindow(theWindow, theDepth);
- return kSuccess;
- case kHelpWindow:
- DrawTheHelpWindow(theWindow, theDepth);
- return kSuccess;
- case kFloatingWindow:
- DrawTheFloatingWindow(theWindow, theDepth);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError ChangeDepthDispatch(short index, short newDepth)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kAboutMSGWindow:
- ChangeDepthTheAboutMSGWindow(theWindow, newDepth);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError CopybitsDispatch(short index, WindowPtr offscreenWindow)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kOtherMSGWindow:
- CopybitsTheOtherMSGWindow(theWindow, offscreenWindow);
- return kSuccess;
- case kMainWindow:
- CopybitsTheMainWindow(theWindow, offscreenWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError IdleWindowDispatch(short index, Point mouseLoc)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kMainWindow:
- IdleInMainWindow(theWindow, mouseLoc);
- return kSuccess;
- case kFloatingWindow:
- IdleInFloatingWindow(theWindow, mouseLoc);
- return kPassThrough;
- }
-
- return kFailure;
- }
-
- enum DispatchError ActivateWindowDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kOtherMSGWindow:
- ActivateTheOtherMSGWindow(theWindow);
- return kSuccess;
- case kMainWindow:
- ActivateTheMainWindow(theWindow);
- return kSuccess;
- case kFloatingWindow:
- ActivateTheFloatingWindow(theWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError DeactivateWindowDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kOtherMSGWindow:
- DeactivateTheOtherMSGWindow(theWindow);
- return kSuccess;
- case kMainWindow:
- DeactivateTheMainWindow(theWindow);
- return kSuccess;
- case kFloatingWindow:
- DeactivateTheFloatingWindow(theWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError GrowWindowDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kOtherMSGWindow:
- ResizeControlsInOtherMSGWindow(theWindow);
- return kSuccess;
- case kMainWindow:
- ResizeControlsInMainWindow(theWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError ZoomWindowDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kOtherMSGWindow:
- ResizeControlsInOtherMSGWindow(theWindow);
- return kSuccess;
- case kMainWindow:
- ResizeControlsInMainWindow(theWindow);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError GetGrowSizeDispatch(short index, Rect *sizeRect)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kOtherMSGWindow:
- GetGrowSizeOtherMSGWindow(theWindow, sizeRect);
- return kSuccess;
- case kMainWindow:
- GetGrowSizeMainWindow(theWindow, sizeRect);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError KeyDownDispatch(short index, unsigned char theChar)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kAboutWindow:
- KeyDownInAboutWindow(theWindow, theChar);
- return kSuccess;
- case kOtherMSGWindow:
- KeyPressedInOtherMSGWindow(theWindow, theChar);
- return kSuccess;
- case kHelpWindow:
- KeyPressedInHelpWindow(theWindow, theChar);
- return kSuccess;
- case kMainWindow:
- KeyPressedInMainWindow(theWindow, theChar);
- return kSuccess;
- case kFloatingWindow:
- if ((gPostingEvents) || (GetFrontDocumentWindow()!=GetIndWindowPtr(kMainWindow)))
- return kPassThrough;
- else
- KeyPressedInFloatingWindow(theWindow, theChar);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError MouseDownDispatch(short index, Point thePoint)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kAboutWindow:
- MouseDownInAboutWindow(theWindow, thePoint);
- return kSuccess;
- case kOtherMSGWindow:
- MouseClickedInOtherMSGWindow(theWindow, thePoint);
- return kSuccess;
- case kHelpWindow:
- MouseClickedInHelpWindow(theWindow, thePoint);
- return kSuccess;
- case kMainWindow:
- MouseClickedInMainWindow(theWindow, thePoint);
- return kSuccess;
- case kFloatingWindow:
- MouseClickedInFloatingWindow(theWindow, thePoint);
- return kSuccess;
- }
-
- return kFailure;
- }
-
- enum DispatchError UndoDispatch(short index)
- {
- switch (index)
- {
- case kFloatingWindow:
- return kPassThrough;
- break;
- }
-
- return kFailure;
- }
-
- enum DispatchError CutDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kMainWindow:
- GenericCut(theWindow);
- return kSuccess;
- break;
- case kFloatingWindow:
- return kPassThrough;
- break;
- }
-
- return kFailure;
- }
-
- enum DispatchError CopyDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kMainWindow:
- GenericCopy(theWindow);
- return kSuccess;
- case kFloatingWindow:
- return kPassThrough;
- break;
- }
-
- return kFailure;
- }
-
- enum DispatchError PasteDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kMainWindow:
- GenericPaste(theWindow);
- return kSuccess;
- case kFloatingWindow:
- return kPassThrough;
- break;
- }
-
- return kFailure;
- }
-
- enum DispatchError ClearDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kMainWindow:
- GenericClear(theWindow);
- return kSuccess;
- case kFloatingWindow:
- return kPassThrough;
- break;
- }
-
- return kFailure;
- }
-
- enum DispatchError SelectAllDispatch(short index)
- {
- WindowPtr theWindow;
-
- theWindow=GetIndWindowPtr(index);
-
- switch (index)
- {
- case kMainWindow:
- GenericSelectAll(theWindow);
- return kSuccess;
- case kFloatingWindow:
- return kPassThrough;
- break;
- }
-
- return kFailure;
- }
-